﻿@using KL.Store.Core;
@{
    bool itsIp = false;
    IPAddress address;
    if (IPAddress.TryParse(Request.Url.Host, out address))
    {
        switch (address.AddressFamily)
        {
            case System.Net.Sockets.AddressFamily.InterNetwork:
                itsIp = true;
                break;
            case System.Net.Sockets.AddressFamily.InterNetworkV6:
                itsIp = true;
                break;
            default:
                itsIp = false;
                break;
        }
    }

    if (!itsIp && !Request.Url.Host.Contains("cloudapp") && !Request.Url.Host.Contains("localhost") && ((Parameters.WebSiteUrl.Contains("www.") && !Request.Url.Host.StartsWith("www")) || (Parameters.HttpsEnabled && !Request.IsSecureConnection)))
    {
        var newUrl = Request.Url.AbsoluteUri;
        var isRedirected = false;
        if (Parameters.WebSiteUrl.Contains("www.") && !Request.Url.Host.StartsWith("www"))
        {
            newUrl = newUrl.Replace("://", "://www.");
            isRedirected = true;
        }
        if (Parameters.HttpsEnabled && !Request.IsSecureConnection)
        {
            newUrl = newUrl.Replace("http://", "https://");
            isRedirected = true;
        }
        if (isRedirected)
        {
            Response.Redirect(newUrl);
        }
    }
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title | @Parameters.WebSiteTitle</title>
    @if (!string.IsNullOrEmpty(ViewBag.Description))
    {
        <meta name="description" content="@ViewBag.Description"/>
    }
    @if (!string.IsNullOrEmpty(ViewBag.Keywords))
    {
        <meta name="keywords" content="@ViewBag.Keywords"/>
    }

    @if (!string.IsNullOrEmpty(Parameters.FaceBookAppId))
    {
        <meta property="fb:app_id" content="@Parameters.FaceBookAppId"/>
    }
    @if (!string.IsNullOrEmpty(ViewBag.FacebookSharingImage))
    {
        <meta property="og:image" content="@ViewBag.FacebookSharingImage"/>
    }
    @if (!string.IsNullOrEmpty(ViewBag.CanonicalUrl))
    {
        <link rel="canonical" href="@ViewBag.CanonicalUrl" />
    }
    <meta name="google-site-verification" content="AbyjJ-ALkg7Ols7dPh9jBHwU_quAwPw738IHYcJWLxQ" />
    <link href="~/Images/@Parameters.Theme/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <meta name="viewport" content="width=device-width" />
    <meta name="language" content="Turkish">
    <meta name="content-language" content="tr-TR" />


    @{ var cjVer = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString(); }

    <link href="@Url.Content("~/Content/bootstrap.min.css?v=" + cjVer)" rel="stylesheet" type="text/css" />
    @*<link href="@Url.Content("~/Content/" + Parameters.Theme + "/normalize.css")" rel="stylesheet" type="text/css" />*@
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/stylesheet.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/cloud-zoom.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/simple_menu.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/slideshow.css")" rel="stylesheet" type="text/css" />
    @*<link href="@Url.Content("~/Content/" + Parameters.Theme + "/flexslider.css")" rel="stylesheet" type="text/css" />*@
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/livesearch.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/livesearch.css?v=" + cjVer)" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/slippry.css?v=" + cjVer)" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/jquery.bxslider.css?v=" + cjVer)" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/flexslider.css?v=" + cjVer)" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/jquery.lightbox-0.5.css?v=" + cjVer)" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/skeleton.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/touchTouch.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/eStore.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/font-awesome.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/" + Parameters.Theme + "/fancybox/jquery.fancybox.css?v=" + cjVer)" rel="stylesheet" />
    <link href="@Url.Content("~/Content/font-awesome.min.css?v=" + cjVer)" rel="stylesheet" />
    <link href="@Url.Content("~/Content/editlightbox.css?v=" + cjVer)" rel="stylesheet" />

    <link href="@Url.Content("~/Content/carousel.css")" rel="stylesheet" type="text/css" />

    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery-ui-1.8.16.custom.min.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.bxslider.min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.flexslider-min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.elevatezoom.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.lightbox-0.5-mod.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.custom-scrollbar.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.pixelentity.shiner.min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.maskedinput.min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.nivo.slider.pack.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/jquery.custom-scrollbar.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/jquery.pixelentity.shiner.min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/jquery.maskedinput.min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/jquery.fancybox.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/scrollToTop.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/jquery.slides.min.js?v=" + cjVer)" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/header-general.js?v=" + cjVer)" type="text/javascript"></script>
    @Html.Raw(Parameters.LiveChatScript)
</head>
<body>
    <header id="header">
        <div class="container">
            <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3" id="logo">
                <a href="/">
                    <img src="/images/@(Parameters.Theme)/logo.png" alt="@(Parameters.WebSiteTitle)" title="@(Parameters.WebSiteTitle)"></a>
                <p class="tagline"></p>
            </div>
            <div class="col-xs-12 col-sm-9 col-md-9 col-lg-9" id="sepet">
                <div id="cart-holder">
                    <div id="jigoshop_cart">
                        <h3>Sepetim:<span id="cart" class="prod_count">
                            @{Html.RenderAction("GetSummary2", "Cart");}
                        </span></h3>
                        <div class="sepetHover">
                            <h4>Sepetim</h4>
                            @if (Request.IsAuthenticated || Parameters.AllowVisitorsToUsingCart)
                            {
                                <div id="sepetMinimalContent">
                                    @{Html.RenderAction("GetMinimal", "Cart", new { showPhotos = true, ShowAcrIcrLinks = true });}
                                </div>
                                <div class="right checkout-button">
                                    <a href="/Cart/Index" class="btn btn-custom3"><span>Sepete Git</span></a>
                                    <a href="/Cart/Checkout" class="btn btn-custom1"><span>Sepeti Onayla</span></a>
                                </div>
                            }
                            else
                            {
                                <span>Sepetinizi görebilmek için giriş yapınız.</span>
                            }
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
            <div id="top-search" class="col-xs-12 col-sm-9 col-md-9 col-lg-9 alignright">
                <form method="get" action="/Search/Index" id="top-search-form">
                    <input type="text" name="Search" id="Search" placeholder="Ara" class="input-search" autocomplete="off" />
                    <button type="submit" class="btn"><i class="glyphicon glyphicon-search"></i>&nbsp;Arama</button>
                    <div id="livesearch_search_results" class="window searchview" style="display: none;">
                        <div id="divSearchResult" style="padding: 6px;">
                        </div>
                    </div>
                </form>
                <div class="clear"></div>
            </div>
            <div id="user-section" class="col-xs-12 col-sm-9 col-md-9 col-lg-9">
                @{Html.RenderAction("Login", "Partials");}
                <div class="clear"></div>
            </div>
        </div>
        <div class="clear"></div>
    </header>
    <div class="hidden-xs hidden-sm main-menu">
        <div class="container">
            <nav>
                @Html.Raw(Parameters.PageMainMenu)
            </nav>
        </div>
    </div>
    <div class="hidden-md hidden-lg">
        <div class="container">
            <nav>
                @Html.Raw(Parameters.PageMainMenuMobil)
            </nav>
        </div>
    </div>
    <div class="container">
        @RenderBody()
    </div>
    @Html.Raw(Parameters.PageFooter)
    <div id="Loading">
        <div class="Loading">
            <img src="/Images/Default/loading.gif" alt="Loading" />
        </div>
    </div>
    @*Hızlı Bak*@
    @{Html.RenderAction("QuickView", "Product");}
    @*Marka ve Ürün Arama*@
    @{Html.RenderAction("SearchBrandAndProducts", "Partials");}
    <script type="text/javascript">
        function GetSearchProduct()
        {
            var myText = $("#Search").val();
            $.ajax({
                url: '/Search/LiveSearch?search=' + myText,
                type: 'POST',
                success: function (result)
                {
                    $("#divLoadingGif").css("display", "none");
                    var myProductList = $(result);
                    var myHtlmString = '';
                    $.each(myProductList[0].LiveSearch, function (key, val)
                    {
                        myHtlmString += '<li><a href="' + val.LinkUrl + '">' + val.ProductCode + ' - ' + val.ProductName + '</a></li>';
                    });
                    myHtlmString = '<ul id="live_search_results">' + myHtlmString + '</ul>';
                    $("#divSearchResult").html(myHtlmString);
                }
            });
        }
        var search = (function ()
        {
            var builder = function ()
            {
                $(document).ready(function ()
                {
                    var lastSearched = "";
                    var object = $('#Search', $('.window.searchview').hide().parent()).focus(function ()
                    {
                        this.active = true;
                        var value = $.trim(this.value);
                        if (value == object.data('empty'))
                        {
                            object.val('').parent().addClass('focus');
                        } else if (value.length >= 3) { search.show(); }
                    }).blur(function ()
                    {
                        this.active = false;

                        $(this.parentNode).removeClass('focus');
                        if ($.trim(object.val()) == '') { object.val(object.data('empty')); }
                    }).keyup(function (e)
                    {
                        if (e.which != 38 && e.which != 40 && e.which != 13 && lastSearched != $('#Search').val())
                        {
                            lastSearched = $('#Search').val();
                            if (object.val().length >= 4)
                            {
                                $("#divLoadingGif").css("display", "block");
                                GetSearchProduct();
                                search.show();
                                $(this.parentNode).removeClass('focus');
                            }
                            else
                            {
                                search.hide();
                                $(this.parentNode).addClass('focus');
                            }
                        }
                    });

                    var parent = object.parents('.container').hover(function () { this.active = true; }, function ()
                    {
                        this.active = false;
                        if (!object.prop('active')) { search.hide(); }
                    });
                    $(".menu-level1").each(function ()
                    {
                        var listIndex = $(this).index();
                        var setTopValue = 0 - (listIndex * 35) - 4;
                        var setTopValuePos = (listIndex * 35) - 4;
                        var setCombTopValue = (listIndex * 35) - 6;
                        if (listIndex != 0 && $(this).find(".level-2-cat").height() > setTopValuePos)
                        {
                            $(this).find(".level-2-cat").css({ "top": "" + setTopValue + "px" });
                            $(this).find(".level-2-cat").find(".menu-level2-integrate").css({ "top": "" + setCombTopValue + "px" });
                            $(this).find(".level-2-cat").find("li .level-2-cat").removeAttr("style");
                        }
                    });
                });
            }
            builder.prototype = {
                busy: false,
                show: function () { $('.window.searchview').stop(true, true).animate({ opacity: 'show', height: 'show' }, 'fast'); },
                hide: function () { $('.window.searchview').stop(true, true).animate({ opacity: 'hide', height: 'hide' }, 'fast'); }
            };

            return new builder();
        })();

        var headerElement = $('#header');
        headerElement.find('input#Search').keyup(function (e)
        {
            var ls = headerElement.find('#livesearch_search_results');
            var lc = headerElement.find('#livesearch_search_results #divSearchResult #live_search_results li').size();
            if (lc > 0)
            {
                var newSelected = null;
                selectedSize = headerElement.find('#live_search_results li a.selected').size();
                selectedItem = headerElement.find('#live_search_results li a.selected');
                if (e.which == 40)
                {
                    //down arrow key
                    if (selectedSize <= 0)
                    {
                        headerElement.find('#live_search_results li:first-child a').addClass('selected');
                    }
                    else
                    {
                        newSelected = headerElement.find('#live_search_results li a.selected').parent().next().find('a');
                        headerElement.find('#live_search_results li a').removeClass('selected');
                        newSelected.addClass('selected');
                    }
                    return false;
                }
                else if (e.which == 38)
                {
                    //up arrow key
                    if (selectedSize <= 0)
                    {
                        headerElement.find('#live_search_results li:last-child a').addClass('selected');
                    }
                    else
                    {
                        newSelected = headerElement.find('#live_search_results li a.selected').parent().prev().find('a');
                        headerElement.find('#live_search_results li a').removeClass('selected');
                        newSelected.addClass('selected');
                    }
                    return false;
                }
                else if (e.which == 13)
                {
                    //enter key
                    if (selectedSize <= 0)
                    {
                        window.location.href = "/Search/Index?Search=" + headerElement.find('#Search').val();
                    }
                    else
                    {
                        window.location.href = selectedItem.attr('href');
                    }
                }
            }
        });
        $(document).ready(function ()
        {
            $(".act-cat").toggle(
                    function ()
                    {
                        $(this).next('.level-2-cat').slideToggle("slow"), {
                            duration: 'slow',
                            easing: 'easeOutBounce'
                        };
                    },
                    function ()
                    {
                        $(this).next('.level-2-cat').slideToggle("slow"), {
                            duration: 'slow',
                            easing: 'easeOutBounce'
                        };
                    }
                );
            $('.box-category li').last().addClass('last');
            $('.box-category li li').last().addClass('last');
            $(".TelefonNo").mask("0(999) 999 9999");
            $(".TcKimlikNo").mask("99999999999");
            $(".n_serino").mask("a99");
            $(".n_cuzdanno").mask("999999");
            $(".n_numerik10").mask("?9999999999");
            $(".aylikgelir").mask("?999999999");
            $("input[name=Phone]").mask("0(999) 999 9999");
            $("input[name=Mobile]").mask("0(999) 999 9999");
            $("input[name=OtherTcKimlikNo]").mask("99999999999");
            $("input[name=OtherMonthlyIncoming]").mask("?99999999");
        });
        $(document).ajaxComplete(function ()
        {
            $(".TelefonNo").mask("0(999) 999 9999");
            $(".TcKimlikNo").mask("99999999999");
            $(".n_serino").mask("a99");
            $(".n_cuzdanno").mask("999999");
            $(".n_numerik10").mask("?9999999999");
            $(".aylikgelir").mask("?999999999");
            $("input[name=Phone]").mask("0(999) 999 9999");
            $("input[name=Mobile]").mask("0(999) 999 9999");
            $("input[name=OtherTcKimlikNo]").mask("99999999999");
            $("input[name=OtherMonthlyIncoming]").mask("?99999999");
        });
        function imagesOnError()
        {
            $('.products ul li .product-outer .product-inner .product-image a.prdLink img').error(function ()
            {
                $(this).attr('src', '/Images/@Parameters.Theme/product-image-not-found-200x.jpg');
            });
            $('.special-products-content ul li a img').error(function ()
            {
                $(this).attr('src', '/Images/@Parameters.Theme/product-image-not-found-200x.jpg');
            });
            $('.suggested-products-content ul li a img').error(function ()
            {
                $(this).attr('src', '/Images/@Parameters.Theme/product-image-not-found-200x.jpg');
            });
            $('.shop-cart table tbody tr td.image img').error(function ()
            {
                $(this).attr('src', '/Images/@Parameters.Theme/product-image-not-found-200x.jpg');
            });
            $('.related-products-content ul li a img').error(function ()
            {
                $(this).attr('src', '/Images/@Parameters.Theme/product-image-not-found-200x.jpg');
            });
            $('.categories ul li .category-outer .category-inner .category-image img').error(function ()
            {
                $(this).attr('src', '/Images/@Parameters.Theme/category-image-not-found.jpg');
            });
        }
    </script>
    <script type="text/javascript">
        $('#Loading').hide();

        $('a.pLink222').click(function ()
        {
            var qsId = $(this).attr('id').split("_")[1];
            $('#content').load('/Products/Get', { id: qsId });

            $('a.pLink').removeClass("active");
            $('a.cLink').removeClass("active");
            $(this).addClass("active");
            return false;
        });
        $('a.cLink222').click(function ()
        {
            var qsId = $(this).attr('id').split("_")[1];
            $('#content').load('/Categories/Get', { id: qsId });

            $('a.pLink').removeClass("active");
            $('a.cLink').removeClass("active");
            $(this).addClass("active");
            return false;
        });

        var afth = $('a.cLink[href="' + location.pathname + '"]');
        if (afth.attr('id') == undefined)
        {
            afth = $('a.pLink[href="' + location.pathname + '"]');
        }

        if (afth.attr('id') != undefined)
        {
            afth.addClass('active');

            afth.parents('ul').css('display', 'block');

            afth.parent().addClass('active');
            afth.parent().parents('ul').css('display', 'block');
            afth.parent('ul').css('display', 'block');
        }
    </script>
    <script type="text/javascript">
        // initialise plugins
        jQuery(function ()
        {
            $("nav select").change(function ()
            {
                window.location = $(this).find("option:selected").val();
            });
        });


    </script>
    <script src="~/Scripts/fancylaunch.js"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/Scripts/footer-general.js?v=" + cjVer)" type="text/javascript"></script>
    @Html.Raw(Parameters.AddThisShareButtonsSmartLayerScript)
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/html5shiv.js")" type="text/javascript"></script>
    <script src="@(Parameters.WebSiteScriptUrl)@Url.Content("~/scripts/respond.js")" type="text/javascript"></script>
</body>
</html>
